﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.TradeChannel.AliPay.Request.BizContent
{
    /// <summary>
    /// Wab 手机支付
    /// </summary>
    public class WapPayBizContent : ABizContent
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="order"></param>
        public WapPayBizContent(IOrderPayApply order)
        {
            subject = AService.FixedLengthString(order.Subject, 128);
            body = AService.FixedLengthString(order.Body, 1000);
            out_trade_no = order.OrderNo;
            timeout_express = DiffDate(order);
            total_amount = order.OrderMoney;
            product_code = "QUICK_WAP_PAY";

        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="order"></param>
        /// <returns></returns>
        protected string DiffDate(IOrderPayApply order)
        {
            var ts = order.ExpireTime - order.StartTime;
            if (ts.TotalMinutes > 0)
            {
                return ((int)ts.TotalMinutes).ToString() + "m";
            }
            return "";
        }

        /// <summary>
        /// 
        /// </summary>
        public string body { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        public string subject { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        public string out_trade_no { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        public string timeout_express { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        public decimal total_amount { get; private set; }

        /// <summary>
        /// 
        /// </summary>
        public string product_code { get; private set; }
       
    }
}
